# 物料主档
from api_setting import *
from dim_api_auto_test.DimAPI.core.request_client import RestClient
from dim_api_auto_test.DimAPI.search import Search


class MaterialApplyList(RestClient):
    def __init__(self, **kwargs):
        super(MaterialApplyList, self).__init__(**kwargs)
        self.search = Search()

    def delete_mat_code_apply(self):
        """
        删除物料编码申请单
        :return:
        """
        url = DELETE_MAT_CODE_APPLY_URL
        # 获取第1份状态为草稿的物料编码申请单的 id
        order_id = self.search.search_material_code_apply_by_status("DRAFT")["data"][
            "list"
        ][0]["id"]
        params = {"ids": order_id}
        r = self.get(url=url, params=params)
        return r.content
